﻿using System;
using Dng.Application.Logging;

namespace ShippingManage
{
	public partial class ObjectPreviewForm : FormBase
	{
		public ObjectPreviewForm(object obj)
		{
			InitializeComponent();
			propertyGrid1.SelectedObject = obj;
			Dng.Application.Reflection.Reflector reflector = new Dng.Application.Reflection.Reflector();
			var ms = reflector.GetMemberInfo(obj, false, true, true, false);
			object value;
			foreach (var item in ms)
			{
				value = reflector.GetValue(item.Name, obj);
				if (item.DeclaringType == typeof(DateTime))
				{
					string dt = Dng.Utilities.Services.I.DT2S((DateTime)value);
					Log.Debug("ObjectPreviewForm", item.Name + ": " + dt + "(" + dt.Length + ")");
				}
				else Log.Debug("ObjectPreviewForm", item.Name + ": " + value + "(" + value.ToString().Length + ")");
			}
		}
	}
}
